﻿/*------------------------------------------------------------
    // Copyright (C) 2009 江苏华招网
    // 版权所有。 
    // 作者：武双 
    //
    // 文件名：BulidPaymentAdd.cs
    // 文件功能描述：结算管理：新增结算单
    // 创建标识：武双2009-05-12
    //
    // 修改标识：
    // 修改描述：
    //
    // 修改标识：
    // 修改描述：
    //
    // 审核人：
// 审核时间：
// 审核说明：
 //----------------------------------------------------------------*/
using System;
using System.Collections;
using System.Configuration;
using System.Data;

using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

using System.Collections.Generic;
using HZ.DrugTrade.Web;
using HZ.DrugTrade.Model;
using HZ.DrugTrade.Model.Enum;
using HZ.DrugTrade.IBLL;
using HZ.DrugTrade.BLLFactory;

namespace HZ.DrugTrade.Web.Hospitals.StorageManage
{
    public partial class PurchaseBuyAnnalDetails : BasePage
    {
        //public PurchaseBuyAnnalDetails()
        //{
        //    this.ModuleNo = Module.采购单管理.ToString();
        //}
        public string CompanyName_PS;
        IBLL.IBLL_Purchase iPurchase = BLLFactory.Factory.BLL_Purchase();

        protected void Page_Load(object sender, EventArgs e)
        {

            if (!IsPostBack)
            {
                Binddata();
            }
        }

        protected void Binddata()
        {
            int totalrecord = 0;
            //AspNetPager1.PageSize = Constants.GRIDVIEW_PAGE_SIZE;
            Model.Query.Distribution where = new HZ.DrugTrade.Model.Query.Distribution();
            if (CurrentAccount.GetUser().UserID.Substring(0, 2).Equals("QS"))
            {
                where.CompanyID_SC = CurrentAccount.GetUser().Org.OrgID;
            }
            else if (CurrentAccount.GetUser().UserID.Substring(0, 2).Equals("QJ"))
            {
                where.CompanyID_TB = CurrentAccount.GetUser().Org.OrgID;
            }
            else
            {
                gvwProduceCatalog.Columns[9].Visible = false;
                where.HospitalID = CurrentAccount.GetUser().Org.OrgID;
            }
            where.CompanyID_PS = Request.QueryString["CID"] != null ? Request.QueryString["CID"].ToString() : "";
            where.ProcureCatalogID = Request.QueryString["PID"] != null ? Request.QueryString["PID"].ToString() : "";
            //where.Append = " purchasecount >0";
            where.SortFields = " ExecuteTime ";
            IList<Model.View.Distribution> lstStahosp3 = iPurchase.GetDistribution_Page(where, this.AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, out totalrecord);
            if (lstStahosp3.Count > 0)
            {
                CompanyName_PS = lstStahosp3[0].CompanyName_PS;
                gvwProduceCatalog.DataSource = lstStahosp3;
                gvwProduceCatalog.DataBind();
                this.AspNetPager1.RecordCount = totalrecord;
            }
        }


        protected void AspNetPager1_OnPageChanged(object sender, EventArgs e)
        {
            Binddata();
        }
        protected void btnQuery_Click(object sender, EventArgs e)
        {
            AspNetPager1.CurrentPageIndex = 1;
            Binddata();
        }

    }

}